package Actions;
/*
 * Written by Phat Le
 */
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import Model.ProgramChair;
import View.DesignateSubPCView;
/**
 * Do designate subpc.
 * @author Phat
 *
 */
public class DesignateSubPCAction extends AbstractAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ProgramChair pc;
	private DesignateSubPCView desgSPC;
	private JTable table;
	
	public DesignateSubPCAction(final JTable a_table, final ProgramChair a_pc) {
		table = a_table;
		pc = a_pc;
		this.putValue(NAME, "Designate SubPC");
		this.putValue(MNEMONIC_KEY, KeyEvent.VK_R);
	
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(table.getSelectedRow() != -1){
			desgSPC = new DesignateSubPCView(table, pc);
			desgSPC.start();
			desgSPC.updateLabels();
		} else{
			JOptionPane.showMessageDialog(null, "Please select a manuscript to designate to a SubPC");
		}
		
	}

}
